package com.dcxm.stu.rowmapper;

import com.dcxm.stu.bean.Student;
import org.springframework.jdbc.core.RowMapper;

import java.sql.ResultSet;
import java.sql.SQLException;

/**
 * Created by young on 2017/3/24.
 * @version 1.0
 */
public class StudentRowMapper implements RowMapper<Student> {

    /**
     *
     * @param resultSet 结果集
     * @param i 索引
     * @return student
     * @throws SQLException
     */
    public Student mapRow(ResultSet resultSet, int i) throws SQLException {
        Student student = new Student();
        student.setUsername(resultSet.getString("username"));
        student.setTelphone(resultSet.getString("telphone"));
        student.setPassword(resultSet.getString("password"));
        return student;
    }
}
